from sqlalchemy import create_engine
from sqlalchemy import text
from pathlib import Path
from src.utils.loggers import db_logger


curDir = Path(__file__).parent
db_dir_coodinate = curDir / 'db.sqlite3'

engine_coordinate = create_engine(f'sqlite:///{db_dir_coodinate}', echo=True)
db_logger.info(f"数据库连接成功！数据库路径：{db_dir_coodinate}")


def test_db():
    with engine_coordinate.connect() as conn:
        result = conn.execute(text("SELECT 1"))
        print(result.fetchone())
